package com.marketingexpert.controller.usermgnt;

import java.io.PrintWriter;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;

public class CheckIsAdminController implements Controller {

	@Override
	public ModelAndView handleRequest(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		response.setContentType("text/html;charset=GBK");  
		PrintWriter out = response.getWriter();
		if(request.getSession().getAttribute("isAdmin") != null) {
			if(((Boolean)request.getSession().getAttribute("isAdmin")) == true) {
				out.print(true);
			} else {
				out.print(false);
			}
		} else {
			out.print(false);
		}		
		return null;
	}

}
